
# Common variables
# sfmv
# age
# woman
# community
# country
# wave
# not_panel

ug1 <- 
  ug1 %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = age, 
    woman = female, 
    country = "ug", 
    wave = 1, 
    community = paste0(country, wave, as.integer(tc)), 
    not_panel = 1
  )
ug2 <- 
  ug2 %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = age, 
    woman = female, 
    country = "ug", 
    wave = 2, 
    community = paste0(country, wave, as.integer(tc_id)), 
    not_panel = 1
  )
ug3 <- 
  ug3 %>% 
  mutate(
    sfmv = demand_mobs_binary, 
    age = age, 
    woman = female, 
    country = "ug", 
    wave = 3, 
    community = paste0(country, wave, as.integer(tc_id)), 
    not_panel = as.numeric(!id %in% ug2$id)
  )
tan <- 
  tan %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = age_q2_3, 
    woman = female, 
    country = "ta", 
    wave = 1, 
    community = paste0(country, wave, as.integer(village)), 
    not_panel = 1
  )
tan2 <- 
  tan2 %>% 
  mutate(
    sfmv = beat_thief, 
    age = b_age %>% as.numeric(), 
    woman = female, 
    country = "ta", 
    wave = 2, 
    community = paste0(country, wave, as.integer(village)), 
    not_panel = 1
  )
tan3 <- 
  tan3 %>% 
  mutate(
    sfmv = beat_thief, 
    age = resp_age, 
    woman = female, 
    country = "ta", 
    wave = 3, 
    community = paste0(country, wave, as.integer(as.factor(s1q4_village))), 
    not_panel = 1
  )

sa <- 
  sa %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = q20 %>% as.character() %>% as.numeric(), 
    woman = female, 
    country = "sa", 
    wave = 1, 
    community = paste0(country, wave, as.integer(community)), 
    not_panel = 1
  )


common_variables <- 
  c(
    "sfmv",
    "age",
    "woman",
    "country",
    "wave",
    "community",
    "not_panel"
  )


full_data <- 
  rbind(
    ug1 %>% select(.vars = all_of(common_variables)),
    ug2 %>% select(.vars = all_of(common_variables)),
    ug3 %>% select(.vars = all_of(common_variables)),
    tan %>% select(.vars = all_of(common_variables)),
    tan2 %>% select(.vars = all_of(common_variables)),
    tan3 %>% select(.vars = all_of(common_variables)),
    sa %>% select(.vars = all_of(common_variables)))

names(full_data) <- common_variables

























